<template>
  <div class="app">
    <user-info @submit="onSubmit" title="注册">
      <div class="box">
        <router-link to="/login" class="link-right">跳转登录</router-link>
      </div>
    </user-info>
  </div>
</template>

<script>
import UserInfo from "@/components/UserInfo.vue";
import { register_API } from "@/api/user";
export default {
  components: {
    UserInfo,
  },
  data() {
    return {};
  },
  methods: {
    async onSubmit(values) {
      const { data } = await register_API(values);
      if (data.code === 10000) this.$toast.success("注册成功");
      this.$router.push({
        path: "/login",
      });
    },
  },
};
</script>

<style scoped>
</style>